home *** CD-ROM | disk | FTP | other *** search
/ Freelog 46 / Freelog046.iso / Alu / Celestia / Win32LoresTex / celestia-lores-win32-1.3.0.exe / {app} / shaders / diffuse_texoff_arb.vp < prev    next >
Text File  |  2003-02-17  |  1KB  |  39 lines

  1. !!ARBvp1.0
  2.  
  3. # Compute the diffuse light from a single source and apply a texture
  4. # translation.
  5.  
  6. ATTRIB iPos          = vertex.position;
  7. ATTRIB iNormal       = vertex.normal;
  8. ATTRIB iTex0         = vertex.texcoord[0];
  9. PARAM  mvp[4]        = { state.matrix.mvp };
  10. PARAM  lightDir      = program.env[0];
  11. PARAM  diffuse       = program.env[2];
  12. PARAM  texOffset     = program.env[7];
  13. PARAM  ambient       = state.lightmodel.ambient;
  14. PARAM  zeroVec       = { 0, 0, 0, 0 };
  15. OUTPUT oPos          = result.position;
  16. OUTPUT oColor        = result.color;
  17. OUTPUT oTex0         = result.texcoord[0];
  18.  
  19. TEMP   diffuseFactor;
  20.  
  21. # Transform the vertex by the modelview matrix
  22. DP4   oPos.x, mvp[0], iPos;
  23. DP4   oPos.y, mvp[1], iPos;
  24. DP4   oPos.z, mvp[2], iPos;
  25. DP4   oPos.w, mvp[3], iPos;
  26.  
  27. # Compute the diffuse light component
  28. DP3   diffuseFactor, iNormal, lightDir;
  29. # Clamp the diffuse component to zero
  30. MAX   diffuseFactor, diffuseFactor, zeroVec;
  31.  
  32. # Output the texture
  33. ADD   oTex0, iTex0, texOffset;
  34. # Output the primary color
  35. MAD   oColor, diffuse, diffuseFactor, ambient;
  36.  
  37. END
  38.  
  39.